﻿using System;
using System.Globalization;
using Dpx.Util;
using Xamarin.Forms;

namespace Dpx.Converters {
    /// <summary>
    /// 收藏转换器。
    /// </summary>
    public class FavoriteConverter : IValueConverter {
        public object Convert(object value, Type targetType, object parameter,
            CultureInfo culture) {
            if (!(value is bool b)) {
                return null;
            }

            return b ? "已收藏" : "未收藏";
        }

        public object ConvertBack(object value, Type targetType,
            object parameter, CultureInfo culture) {
            throw new DoNotCallThisException();
        }
    }
}